//
//  HYOUUserTableViewCell.m
//  BestGift
//
//  Created by 温晓宇 on 16/1/13.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "HYOUUserTableViewCell.h"

@interface HYOUUserTableViewCell ()

@property(nonatomic, retain) UIImageView *myImage;
@property(nonatomic, retain) UILabel *title;


@end

@implementation HYOUUserTableViewCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self create];
    }
    return self;
}
-(void)create{
    self.myImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 100, 80)];
//    self.myImage.backgroundColor = [UIColor redColor];
    self.contentView.layer.borderColor = [UIColor lightGrayColor].CGColor;
    self.contentView.layer.borderWidth = 1;
    [self.contentView addSubview:self.myImage];
    
    self.title = [[UILabel alloc] initWithFrame:CGRectMake(130, self.myImage.frame.size.height / 2 - 20, WIDTH - self.myImage.frame.size.width - 50 , 60)];
//    self.title.backgroundColor = [UIColor cyanColor];
    [self.contentView addSubview:self.title];
}
-(void)setHome:(HYOUOneCellModel *)home{
    if (_home != home) {
        [_home release];
        _home = [home retain];
    }
    NSURL *url = [NSURL URLWithString:self.home.cover_image_url];
    [self.myImage sd_setImageWithURL:url];
    
    self.title.text = self.home.title;
}
@end
